package com.cqndt.disaster.device.controller;

import com.cqndt.disaster.device.util.AjaxResult;
import org.springframework.web.bind.annotation.PostMapping;
import com.cqndt.disaster.device.service.AppTabProjectService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author lgb
 * @date 2020-9-1
 * @return 设备管理
 **/
@RestController
@RequestMapping(value="/api/v2/project")
public class TabMonitorController extends BaseController{

	@Autowired
	private AppTabProjectService tabProjectService;

    /**
     * @param projectId 项目id
     * @param search 查询条件(device_name 设备名称)
     * @param monitorType 设备类型
     * @return 通过项目id获取相关设备
     **/
    @PostMapping(value="/getRelatedMonitoring")
    public AjaxResult getRelatedMonitoring(Integer projectId, String search, Integer monitorType){
		return entityResult(tabProjectService.getByProjectId(projectId,search,monitorType),"获取项目相关设备");
    }

    /**
     * @param monitorId 监测点id
     * @return 通过监测点id获取设备详情
     **/
    @PostMapping(value="/getMonitorDataById")
    public AjaxResult getMonitorDataById(Integer monitorId){
		return entityResult(tabProjectService.getMonitorDataById(monitorId),"获取项目相关监测点设备详情");
    }
    
}